package chapter3;

import java.util.Scanner;

public class sort10_Demo7 {
    public static void main(String[] args) {
        //分析：//1.键盘录入星期数
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入星期");
        int week = sc.nextInt();
        //3
        // 2.利用switch进行匹配----------------------------------------------------利用case穿透简化代码

        switch (week){
            case 1:
            case 2:
            case 3:case 4: case 5:
            System.out.println("工作日");
                break;
            case 6:
            case 7:
            System.out.println("休息日");
                break;
            default:
            System.out.println("没有这个星期");
                break;
        }
        //----------------------------------------------------利用JDK12简化代码书写
        /*switch (week) {
            case 1, 2, 3, 4, 5 -> System.out.println("工作日");
            case 6, 7 -> System.out.println("休息日");
            default -> System.out.println("没有这个星期");
        }*/
    }
}
